package taper.controller.polypatch;

import lombok.Data;
import java.math.BigDecimal;
import java.util.ArrayList;

public class PolyBean {
   
    public static BigDecimal calculatePolynomial(int padLife,BigDecimal[] coefficients) {
        ArrayList<BigDecimal> power = new ArrayList<BigDecimal>();
        
        BigDecimal adjustment = new BigDecimal(0);
        
       for (int i = 0; i < 10; i++) {
           
            double padLifePower = Math.pow(padLife,i);
            
            // BigDecimal coEff = coefficients[i].multiply(padLifePower);
            //adjustment += (coefficients[i]*(padLifePower));
            BigDecimal result = coefficients[i].multiply(new BigDecimal(padLifePower));
            adjustment = adjustment.add(result);
           
        }
        
        return adjustment;
    }

    
}